<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
<script>

    Function.prototype.call = function(content){
        // console.log(this===fn);// true
        if(typeof content === "undefined" || content === null){
            content = window;
        }else if(typeof content !== "object" && typeof content !== "function"){
            content = new Object(content);
        }
        var key = Math.random().toString(36).slice(2);// k7m3oo50oig
        content[key] = this;// content.k7m3oo50oig = fn;
        // console.log(Array.from(arguments).slice(1).join(","));// 1,2,3,4
        // content[key]();// content.k7m3oo50oig()
        var arg = Array.from(arguments).slice(1).join(",");// 1,2,3,4
        eval("content[key]("+arg+")");// content[key](1,2,3,4)===>content.k7m3oo50oig("1,2,3,4")
        delete content[key];// 内存中清除
    }
    function fn(a,b,c,d){
        console.log("fn",this,a,b,c,d);
    }
    // call的特点：
    //      1- 会调用fn
    //      2- 改变fn中的this
    // fn.call(undefined);
    // fn.call(null);
    // fn.call(1);
    // fn.call("abc")
    // fn.call({},1,2,3,4)
    fn.call([1,2,3,4])
</script>
</html>